package com.secondhand.service.Impl;

import com.secondhand.domain.comment;
import com.secondhand.mapper.commentMapper;
import com.secondhand.service.commentService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Log4j2
@Service
public class commentServiceImpl implements commentService {
    @Autowired
    commentMapper commentMapper;

    @Override
    public Boolean addComment(comment comment) {
        comment.setCommentTime(System.currentTimeMillis());
        int insert = commentMapper.insert(comment);
        return insert !=0 ;
    }

    @Override
    public List<comment> gainCommentsList(int goodid) {
        List<comment> comment = commentMapper.getCommentByGoodId(goodid);
        return comment;
    }
}
